/*
 * exceptions.hpp
 *
 *  Created on: 13 mai 2014
 *      Author: Raphaël
 */

#ifndef EXCEPTIONS_HPP_
#define EXCEPTIONS_HPP_

#include <exception>
#include <string>

namespace raph
{
namespace tools
{
namespace exceptions
{

class RaphException: public std::exception
    {
    private:
        std::string m_msg;

    public:
        RaphException(const std::string msg = "") :
                std::exception(), m_msg(msg)
            {
            }

        const char* what() const noexcept
            {
            return m_msg.c_str();
            }

        static std::string info(const char* file, const int &line)
            {
            std::string str;
            str.append(file);
            str.append(" : ");
            str.append(raph::tools::Convert::toString(line));
            return str;
            }
    };

class EmptyCollectionException: public RaphException
    {
    public:
        EmptyCollectionException(const std::string msg = "") :
                RaphException(msg)
            {
            }
    };

class NotSameLengthCollectionsException: public RaphException
    {
    public:
        NotSameLengthCollectionsException(const std::string msg = "") :
                RaphException(msg)
            {
            }
    };

class MathException: public RaphException
    {
    public:
        MathException(const std::string msg = "") :
                RaphException(msg)
            {
            }
    };

class MedianException: public MathException
    {
    public:
        MedianException(const std::string msg = "") :
                MathException(msg)
            {
            }

    };

}
}
}

#endif /* EXCEPTIONS_HPP_ */
